package com.ahms.customer.controller;

import com.ahms.common.core.controller.BaseController;
import com.ahms.common.core.domain.AjaxResult;
import com.ahms.common.core.page.TableDataInfo;
import com.ahms.customer.domain.News;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ahms.customer.service.INewsService;

import java.util.List;

/**
 * 新闻Controller
 * 
 * @author 
 * @date 2025-04-09
 */
@RestController
@RequestMapping("/customer/news")
public class CustomerNewsController extends BaseController
{
    @Autowired
    private INewsService newsService;


    /**
     * 普通用户前台查询新闻列表
     */
    @GetMapping("/list")
    public TableDataInfo list(News news)
    {
        startPage();
        List<News> list = newsService.selectNewsList(news);
        return getDataTable(list);
    }
    /**
     * 获取新闻详细信息
     */
    @GetMapping(value = "/{newsId}")
    public AjaxResult getInfo(@PathVariable("newsId") Long newsId)
    {
        return success(newsService.selectNewsByNewsId(newsId));
    }
}
